package com.joker.service.Impl;

import com.joker.bean.Notice;
import com.joker.dao.INotice;
import com.joker.service.NoticeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
public class NoticeServiceImpl implements NoticeService {

    @Autowired
    private INotice INotice;

    @Override
    public List<Notice> showAllNotice() {
        return INotice.queryAll();
    }

    @Override
    public Notice getOneNotice(String id) {
        return INotice.queryOneById(id);
    }

    @Override
    @Transactional
    public int addNotice(Notice notice) {
        return INotice.addOne(notice);
    }

    @Override
    @Transactional
    public int deleteNotice(String id) {
        return INotice.deleteOneById(id);
    }

    @Override
    @Transactional
    public int updateNotice(Notice notice) {
        return INotice.updateOneId(notice);
    }
}
